<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="./js/vue.min.js"></script>
    <title>计算属性的基本使用</title>
</head>
<body>
<div id="app">
    <!--Mastance语法-->
    <h2>{{firstName + " " + lastName}}</h2>
    <!--方法-->
    <h2>{{getFullName()}}</h2>
    <!--计算属性-->
    <h2>{{fullName}}</h2>
</div>
</body>
<script>
    const app = new Vue({
        el:"#app",
        data:{
            firstName:"Wong",
            lastName:"Ho"
        },
        computed:{
            fullName:function () {
                return this.firstName + " " + this.lastName;
            }
        },
        methods: {
            getFullName() {
                return this.firstName + " " + this.lastName;
            }
        }
    })
</script>
</html>